const express = require("express")
const router = express.Router()
const {Category} = require("../models")
const {Op} = require("sequelize")

const {success} = require("../utils/response")

router.get("/", async (req, res, next) => {
    try {
        const categories = await Category.findAll({
            order: [ ['rank', "ASC"], ['id', 'DESC']],
        })
        success(res, "查询分类列表成功", categories)
    } catch(err) {
        next(err)
    }
})

module.exports = router